package org.ko.core.domain.auth;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.ko.core.domain.support.BaseEntity;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 
 * @author ByTheWay
 *	菜单角色关系表
 */
@Entity
@Table(name="SYS_ROLE_MENU")
public class RoleMenuAction extends BaseEntity{
	private static final long serialVersionUID = 1412265326521084580L;


	
	
	private Menu menu;
	
	
	private Role role;
	
	
	public RoleMenuAction() {
	}
	public RoleMenuAction(Long id) {
		this.setId(id);
	}
	
	public RoleMenuAction(Long id, Long menuId) {
		this.role=new Role(id);
		this.menu=new Menu(menuId);
	}
	
	@JsonIgnore
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="menu_id",nullable=false)
	public Menu getMenu() {
		return menu;
	}
	public void setMenu(Menu menu) {
		this.menu = menu;
	}
	@JsonIgnore
	@ManyToOne
	@JoinColumn(name="role_id",nullable=false)
	public Role getRole() {
		return role;
	}
	public void setRole(Role role) {
		this.role = role;
	}
}
